package com.thesis.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Hashtable;

public class AllBusStop {
	private Hashtable<Character, BusStop> data = new Hashtable<Character, BusStop>();

	public AllBusStop(String filename) {
		BufferedReader br;
		try {
			br = new BufferedReader(new FileReader(filename));
			String line;
			BusStop temp;
			while ((line = br.readLine()) != null) {
				temp = new BusStop(line);
				data.put(temp.getID(), temp);
				//System.out.println(temp.getID() + "==" + temp.getLine());
				
			}
			br.close();

		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.err.println("Can not open: " + filename);
			e.printStackTrace();
		}
	}
	
	public BusStop getBusStop(char busStopID)
	{
		if (data.containsKey(busStopID))
			return data.get(busStopID);
		return null;
	}
	
}
